﻿Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.IO
Imports System.Data.SqlClient
Imports System.Text
Imports System.Data.OleDb
Imports NPOI
Imports NPOI.HPSF
Imports NPOI.HSSF
Imports NPOI.HSSF.UserModel
Imports NPOI.POIFS
Imports NPOI.Util

Partial Class WebForm_ManageMOIExport
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Me.InitDataAndShow()
            Me.BindVolunteerDataType()
            Me.BindOrganizationDataType()
            Me.BindDDLOrg()
        End If
    End Sub
    '匯出資料
    Protected Sub btnExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExport.Click
 
        Select Case Me.ddlVolunteerDataType.SelectedValue
            Case "HonorCert"
                'Me.HonorCertControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.HonorCertControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.HonorCertControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.HonorCertControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.HonorCertControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.HonorCertControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName
                Me.HonorCertControl1.BindGV()
                ExcelDT = Me.HonorCertControl1.HonorCertDT
            Case "VolunteerInsurance"
                'Me.VolunteerInsuranceControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.VolunteerInsuranceControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.VolunteerInsuranceControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.VolunteerInsuranceControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.VolunteerInsuranceControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.VolunteerInsuranceControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName
                Me.VolunteerInsuranceControl1.BindGV()
                ExcelDT = Me.VolunteerInsuranceControl1.VolunteerInsuranceDT
            Case "WorkHour"

                'Me.WorkHourControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.WorkHourControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.WorkHourControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.WorkHourControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.WorkHourControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.WorkHourControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName
                Me.WorkHourControl1.BindGV()
                ExcelDT = Me.WorkHourControl1.WorkHourDT
            Case "VBook"

                'Me.VBookControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.VBookControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.VBookControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.VBookControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.VBookControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.VBookControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName
                Me.VBookControl1.BindGV()
                ExcelDT = Me.VBookControl1.VBookDT
            Case "TrainingHour"

                'Me.TrainingHourControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.TrainingHourControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.TrainingHourControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.TrainingHourControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.TrainingHourControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.TrainingHourControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName
                Me.TrainingHourControl1.BindGV()
                ExcelDT = Me.TrainingHourControl1.TrainingHourDT
            Case "Volunteer"

                'Me.VolunteerControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.VolunteerControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.VolunteerControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.VolunteerControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.VolunteerControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.VolunteerControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName
                Me.VolunteerControl1.BindGV()
                ExcelDT = Me.VolunteerControl1.VBasicDataDT
        End Select

        GenerateExcel(Me.ddlVolunteerDataType.SelectedValue)
        If ExcelDT.Rows.Count > 0 Then
            ExcelDT.Clear()
        End If
    End Sub
    '志工資料查詢
    Protected Sub btnVolunteerQuery_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnVolunteerQuery.Click

        Select Case Me.ddlVolunteerDataType.SelectedValue
            Case "HonorCert"
                Me.MultiView1.SetActiveView(vwHonorCert)
                'Me.HonorCertControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.HonorCertControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.HonorCertControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.HonorCertControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.HonorCertControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.HonorCertControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName

                Me.HonorCertControl1.BindGV()
            Case "VolunteerInsurance"
                Me.MultiView1.SetActiveView(vwVolunteerInsurance)
                'Me.VolunteerInsuranceControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.VolunteerInsuranceControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.VolunteerInsuranceControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.VolunteerInsuranceControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.VolunteerInsuranceControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.VolunteerInsuranceControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName
                Me.VolunteerInsuranceControl1.BindGV()
            Case "WorkHour"
                Me.MultiView1.SetActiveView(vwWorkHour)

                'Me.WorkHourControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.WorkHourControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.WorkHourControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.WorkHourControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.WorkHourControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.WorkHourControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName

                Me.WorkHourControl1.BindGV()
            Case "VBook"
                Me.MultiView1.SetActiveView(vwVBook)

                'Me.VBookControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.VBookControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.VBookControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.VBookControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.VBookControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.VBookControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName

                Me.VBookControl1.BindGV()
            Case "TrainingHour"
                Me.MultiView1.SetActiveView(vwTrainingHour)

                'Me.TrainingHourControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.TrainingHourControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.TrainingHourControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.TrainingHourControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.TrainingHourControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.TrainingHourControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName

                Me.TrainingHourControl1.BindGV()
            Case "Volunteer"
                Me.MultiView1.SetActiveView(vwVolunteer)

                'Me.VolunteerControl1.Region1ID = Me.VolunteerQueryControl1.Region
                'Me.VolunteerControl1.Region2ID = Me.VolunteerQueryControl1.Region2
                Me.VolunteerControl1.OrganizationID = Me.VolunteerQueryControl1.OrganizationID
                Me.VolunteerControl1.VOrganizationID = Me.VolunteerQueryControl1.VOrganizationID
                Me.VolunteerControl1.VolunteerID = Me.VolunteerQueryControl1.VolunteerId
                Me.VolunteerControl1.VolunteerName = Me.VolunteerQueryControl1.VolunteerName

                Me.VolunteerControl1.BindGV()
        End Select
    End Sub

    '單位資料查詢
    Protected Sub btnOrganizationQuery_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOrganizationQuery.Click
        Select Case Me.ddlOrganizationDataType.SelectedValue
            Case "Manager"
                Me.MultiView2.SetActiveView(vwManager)
                Me.ManagerControl1.OrgID = Me.ddlOrg.SelectedValue
                Me.ManagerControl1.BindGV()
            Case "Organization"
                Me.MultiView2.SetActiveView(vwOrganization)
                Me.OrganizationControl1.OrgID = Me.ddlOrg.SelectedValue
                Me.OrganizationControl1.BindGV()
        End Select
    End Sub
    Protected Sub btnOrganizationExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOrganizationExport.Click

   
        Select Case Me.ddlOrganizationDataType.SelectedValue
            Case "Manager"
                Me.ManagerControl1.OrgID = Me.ddlOrg.SelectedValue
                Me.ManagerControl1.BindGV()
                ExcelDT = Me.ManagerControl1.EmployeeDT
            Case "Organization"
                Me.OrganizationControl1.OrgID = Me.ddlOrg.SelectedValue
                Me.OrganizationControl1.BindGV()
                ExcelDT = Me.OrganizationControl1.OrganizationDT
        End Select
        GenerateExcel(Me.ddlOrganizationDataType.SelectedValue)

        If ExcelDT.Rows.Count > 0 Then
            ExcelDT.Clear()
        End If
    End Sub
    Private Sub BindVolunteerDataType()
        Dim ddlItem As DropDownList = Me.ddlVolunteerDataType
        ddlItem.Items.Add(New ListItem("榮譽卡發放紀錄", "HonorCert"))
        ddlItem.Items.Add(New ListItem("志工保險", "VolunteerInsurance"))
        ddlItem.Items.Add(New ListItem("服務時數", "WorkHour"))
        ddlItem.Items.Add(New ListItem("紀錄冊發放紀錄", "VBook"))
        ddlItem.Items.Add(New ListItem("教育訓練時數", "TrainingHour"))
        ddlItem.Items.Add(New ListItem("志工基本資料", "Volunteer"))
    End Sub

    Private Sub BindOrganizationDataType()
        Dim ddlItem As DropDownList = Me.ddlOrganizationDataType
        ddlItem.Items.Add(New ListItem("管理員基本資料", "Manager"))
        ddlItem.Items.Add(New ListItem("子層單位基本資料", "Organization"))
    End Sub

    Private Sub BindDDLOrg()
        Dim dt As Data.DataTable
        Dim dat As New clsData

        If clsAuth.GetUser().VolunteerLeader = True Then
            Dim sql As New MyStringBuilder

            sql.AppendFormat("select distinct o.OrganizationName, o.DirectUOrganizationID as UOrganizationID from VOrganizationView o ")
            sql.AppendFormat("inner join VolunteerView v on o.UOrganizationID = v.UOrganizationID ")
            sql.AppendFormat("where v.VolunteerID = '{0}' ", clsAuth.GetUserID())

            dt = dat.GetData(sql)
        Else
            Dim sql As New MyOrganizationDataFilter

            sql.AppendFormat("select o.OrganizationName,o.UOrganizationID from OrganizationView o ")
            sql.AppendFormat("where OrganizationType <> 'V' and Active='Y'  ")

            dt = dat.GetData(sql)
        End If

        Me.ddlOrg.DataTextField = "OrganizationName"
        Me.ddlOrg.DataValueField = "UOrganizationID"
        Me.ddlOrg.DataSource = dt
        Me.ddlOrg.DataBind()

        If Me.ddlOrg.Items.Count > 1 Then
            Me.ddlOrg.Items.Insert(0, MyObj.GetDDLSelectAllItem())
            'Else
            '    Me.BindDDLOrg()
        End If
    End Sub
    Protected Sub GenerateExcel(ByVal File As String)

        If ExcelDT.Rows.Count > 0 Then
            For i As Integer = 0 To ExcelDT.Columns.Count - 1
                ExcelDT.Columns(i).ColumnName = ChangeColumnName(ExcelDT.Columns(i).ColumnName)
            Next

            ExcelDT = ExcelDT.DefaultView.ToTable()
            Dim ms As MemoryStream = TryCast(DataTableRenderToExcel.RenderDataTableToExcel(ExcelDT), MemoryStream)
           
            Dim FileName As String = File & ".xls"
            ' 設定強制下載標頭。 
            Response.AddHeader("Content-Disposition", String.Format("attachment; filename=" + FileName))
            ' 輸出檔案。 
            Response.BinaryWrite(ms.ToArray())

            ms.Close()
            ms.Dispose()
        Else
            MyObj.ShowMessage("您選擇的資料類型沒有資料可供匯出!")
        End If

        'If ExcelDT.Rows.Count > 0 Then
        '    Dim tRowCount As Integer = ExcelDT.Rows.Count
        '    Dim tColumnCount As Integer = ExcelDT.Columns.Count

        '    Response.Expires = 0
        '    Response.Clear()
        '    Response.Buffer = True
        '    Response.Charset = "utf-8"
        '    Response.ContentEncoding = System.Text.Encoding.UTF8
        '    Response.ContentType = "application/vnd.ms-excel"
        '    Dim FileName As String = File & ".xls"
        '    Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName)
        '    Response.Write("<meta http-equiv=Content-Type content=text/html;charset=utf-8>")
        '    Response.Write("<META name=generator CONTENT= 帳號:" + clsAuth.GetUserID() & ",下載時間:" + Today.Year.ToString() & "-" & Today.Month.ToString() & "-" & Today.Day.ToString() & Space(1) & Now.Hour.ToString() & ":" & Now.Minute.ToString() & ":" & Now.Second.ToString() & ",IP:" + MyObj.getIP() & ">")
        '    Response.Write("<style type=text/css>")
        '    Response.Write("td{mso-number-format:\@;}") '將所有欄位格式改為"文字"
        '    Response.Write("</style>")

        '    Response.Write("<Table borderColor=black border=1>")
        '    Response.Write(vbLf & " <TR>")
        '    For i As Integer = 0 To tColumnCount - 1
        '        Response.Write(vbLf & " <TD>")
        '        Response.Write(ChangeColumnName(ExcelDT.Columns(i).ColumnName))
        '        Response.Write(vbLf & " </TD>")
        '    Next
        '    Response.Write(vbLf & " </TR>")
        '    For j As Integer = 0 To tRowCount - 1
        '        Response.Write(vbLf & " <TR>")
        '        For k As Integer = 0 To tColumnCount - 1
        '            Response.Write(vbLf & " <TD align=""right"" x:num>")
        '            Response.Write(ExcelDT.Rows(j)(k).ToString())
        '            Response.Write(vbLf & " </TD>")
        '        Next
        '        Response.Write(vbLf & " </TR>")
        '    Next

        '    Response.Write("</Table>")

        '    Response.End()

        'Else
        '    MyObj.ShowMessage("您選擇的資料類型沒有資料可供匯出!")
        'End If
    End Sub
    Public Sub InitDataAndShow()
        VolunteerQueryControl1.InitData()
    End Sub
    Protected Function ChangeColumnName(ByVal ColumnName As String) As String
        Dim ChineseColumnName As String = ""
        Select Case ColumnName
    
            Case "Name", "VolunteerName", "VOlunteerName"
                ChineseColumnName = "姓名"
            Case "IDType"
                ChineseColumnName = "帳號類別"
            Case "ContactPhone"
                ChineseColumnName = "聯絡電話"
            Case "UserPassword"
                ChineseColumnName = "使用者密碼"
            Case "FaxPhone"
                ChineseColumnName = "傳真電話"
            Case "CellPhone"
                ChineseColumnName = "手機號碼"
            Case "Mail"
                ChineseColumnName = "電子郵件"
     
            Case "IdentificationID", "VolunteerID"
                ChineseColumnName = "身分證字號"
            Case "HonorCertCode"
                ChineseColumnName = "榮譽卡編號"

            Case "IssueDate"
                ChineseColumnName = "發卡日期"

            Case "IssuingUnitsViews"
                ChineseColumnName = "審核發卡單位意見"


            Case "StartDate"
                ChineseColumnName = "投保日期_起"

            Case "EndDate"
                ChineseColumnName = "投保日期_訖"

            Case "InsuranceType"
                ChineseColumnName = "投保類別"


            Case "Company"
                ChineseColumnName = "承保公司代碼"

            Case "MoneyLevel"
                ChineseColumnName = "投保金額"

            Case "Charge"
                ChineseColumnName = "投保費用"

            Case "Remark", "MEMO", "Comment"
                ChineseColumnName = "備註"

            Case "WorkStartDate"
                ChineseColumnName = "服務日期起"

            Case "WorkEndDate"
                ChineseColumnName = "服務日期迄"

            Case "WorkItem"
                ChineseColumnName = "服務項目"

            Case "WorkContent"
                ChineseColumnName = "服務內容"

            Case "NumPeople"
                ChineseColumnName = "受服務人次"

            Case "WorkHour"
                ChineseColumnName = "服務時數"

            Case "TCharge"
                ChineseColumnName = "交通費"

            Case "ECharge"
                ChineseColumnName = "誤餐費"

            Case "Status"
                ChineseColumnName = "紀錄冊發冊別"

            Case "SerialGroupID"
                ChineseColumnName = "紀錄冊字"

            Case "SerialNumber"
                ChineseColumnName = "紀錄冊號"

            Case "IssueBookDate"
                ChineseColumnName = "發冊日期"

            Case "TrainingStartDate"
                ChineseColumnName = "受訓日期起"

            Case "TrainingEndDate"
                ChineseColumnName = "受訓日期迄"


            Case "TrainingOrg"
                ChineseColumnName = "訓練單位"

            Case "TrainingType"
                ChineseColumnName = "訓練課程"

            Case "TrainTimes"
                ChineseColumnName = "訓練次數"

            Case "TrainingHour"
                ChineseColumnName = "訓練時數"

            Case "CourseType"
                ChineseColumnName = "課程領域"

            Case "CourseName"
                ChineseColumnName = "課程名稱"

    

            Case "IsAboriginal", "HumanType"
                ChineseColumnName = "是否原住民"

            Case "VounteerType"
                ChineseColumnName = "志工身份別"


            Case "Newpassword", "Password"
                ChineseColumnName = "密碼"

            Case "Gender"
                ChineseColumnName = "性別"

            Case "Birthday"
                ChineseColumnName = "出生日期"

            Case "OccupationType"
                ChineseColumnName = "職業類別"

            Case "EducationLevel"
                ChineseColumnName = "學歷"

            Case "Email"
                ChineseColumnName = "E_MAIL"

            Case "StaffNumber", "PeopleNO"
                ChineseColumnName = "人員編號"

            Case "PositionName"
                ChineseColumnName = "職稱"

            Case "VTeamWorkStartTime"
                ChineseColumnName = "加入志工隊日期"


            Case "RegionID", "RegionNum"
                ChineseColumnName = "郵遞區號"

            Case "VillageID"
                ChineseColumnName = "通訊縣市代碼"

            Case "Address"
                ChineseColumnName = "聯絡地址"


            Case "OfficePhone"
                ChineseColumnName = "聯絡電話1"

            Case "OfficePhone2"
                ChineseColumnName = "聯絡電話2"

            Case "AddressPhone", "HomePhone"
                ChineseColumnName = "住址電話"

            Case "MobilePhone"
                ChineseColumnName = "手機1"

            Case "MobilePhone2"
                ChineseColumnName = "手機2"
            Case "SelfIntroduction"
                ChineseColumnName = "自我介紹"

            Case "Telent1"
                ChineseColumnName = "專長一"

            Case "Telent2"
                ChineseColumnName = "專長二"

            Case "Telent3"
                ChineseColumnName = "專長三"

            Case "ServiceItem1"
                ChineseColumnName = "服務項目一"

            Case "ServiceItem2"
                ChineseColumnName = "服務項目二"

            Case "ServiceItem3"
                ChineseColumnName = "服務項目三"

            Case "StartWorkTime"
                ChineseColumnName = "可服務日期起"

            Case "EndWorkTime"
                ChineseColumnName = "可服務日期迄"

            Case "ServiceTime"
                ChineseColumnName = "可服務時段"

            Case "OrganizationName"
                ChineseColumnName = "單位名稱"

            Case "EmployeeName"
                ChineseColumnName = "管理員姓名"

            Case "EmployeeID"
                ChineseColumnName = "帳號"

     
            Case "DomainType"
                ChineseColumnName = "領域類別"

            Case "CityType"
                ChineseColumnName = "縣市別"

            Case "OrgType"
                ChineseColumnName = "單位類別"

            Case "IsGovernment"
                ChineseColumnName = "政府或民間"

            Case "JoinPlan"
                ChineseColumnName = "加入祥和計畫"

            Case "Phone"
                ChineseColumnName = "聯絡電話"

            Case "Fax"
                ChineseColumnName = "傳真"

            Case "CityCode"

                ChineseColumnName = "地址縣市代碼"
            Case "OrgAddress"
                ChineseColumnName = "單位地址"
            Case "OrgIntroduction"
                ChineseColumnName = "單位介紹"

            Case "EstablishDate"
                ChineseColumnName = "成立日期"

            Case "OrgNO"
                ChineseColumnName = "單位編號"
            Case "Org"
                ChineseColumnName = "隸屬單位"
            Case "SerialGroupText"
                ChineseColumnName = "紀錄冊中文編號"
            Case "SArea"
                ChineseColumnName = "服務區域"
            Case "ApprovedNum"
                ChineseColumnName = "核定字號"
            Case "ApprovedDate"
                ChineseColumnName = "核定日期"
            Case "Nationality"
                ChineseColumnName = "國籍"
            Case "Detail"
                ChineseColumnName = "國籍細項"
            Case "OtherDes"
                ChineseColumnName = "其他國籍說明"

            Case "YearB"
                ChineseColumnName = "民國前"

            Case "MerriedStatus"
                ChineseColumnName = "婚姻狀況"

            Case "Relief"
                ChineseColumnName = "是否加入救災志工"

            Case "Parent"
                ChineseColumnName = "戶籍郵遞區號"

            Case "CommunicationCode"
                ChineseColumnName = "戶籍縣市代碼"

            Case "TCode"
                ChineseColumnName = "戶籍鄉鎮代碼"
            Case "Vcode"
                ChineseColumnName = "戶籍村里代碼"

            Case "Ncode"
                ChineseColumnName = "戶籍鄰"

            Case "Road"
                ChineseColumnName = "戶籍街路門牌"

            Case "FirstServiseDate"
                ChineseColumnName = "最早服務起始日"

            Case "IsAddTeam"
                ChineseColumnName = "收編狀態"
            Case "VolID"
                ChineseColumnName = "志工編號"

            Case "Title"
                ChineseColumnName = "志工職稱"

            Case "ApplyDate"
                ChineseColumnName = "申請日期"


            Case "StartYear"
                ChineseColumnName = "年資日期起"


            Case "EndYear"
                ChineseColumnName = "年資日期迄"


            Case "IssueOrg"
                ChineseColumnName = "審核發卡單位"


            Case "IssueStatus"
                ChineseColumnName = "申請審核狀態"


            Case "ApproveDate"
                ChineseColumnName = "審核日期"


            Case "Expirationdate"
                ChineseColumnName = "有效日期"

            Case "Reason"
                ChineseColumnName = "不符合原因"


        End Select
        Return ChineseColumnName
    End Function
    Private Property ExcelDT() As Data.DataTable
        Get
            Return ViewState("ExcelDT")
        End Get
        Set(ByVal value As Data.DataTable)
            ViewState("ExcelDT") = value
        End Set
    End Property
  
End Class
